﻿using MengLin.OOP.DesignPattern.Decorator.StudentStudy.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.Decorator.StudentStudy
{
    class Program
    {
        static void Main(string[] args)
        {
            #region 继承方式实现包装
            //{
            //    StudentFree studentFree = new StudentFree();
            //    studentFree.Study();
            //}
            #endregion

            #region 组合方式实现包装
            //{
            //    Student student = new Student();
            //    StudentCombination studentCombination = new StudentCombination(student);
            //    studentCombination.Study();
            //}
            #endregion

            #region 组合方式实现包装
            {
                AbstractStudent student = new Student()
                {
                    Id = "123",
                    Name = "勇往直前"
                };
                //BaseDecorator baseDecorator = new BaseDecorator(student);
                //AbstractStudent baseDecorator = new BaseDecorator(student);//里氏替换原则
                //baseDecorator.Study();

                student = new BaseDecorator(student);//把引用类型变量的引用换个地址

                student = new StudentDecoratorEat(student);

                student = new StudentDecoratorGoToilet(student);

                student.Study();
            }
            #endregion
        }
    }
}
